package cn.openea.perpartner.payment.web.wallet.controller;

import cn.openea.perpartner.common.core.web.controller.BaseController;
import cn.openea.perpartner.common.core.web.domain.AjaxResult;
import cn.openea.perpartner.payment.web.wallet.entity.Dialog;
import cn.openea.perpartner.payment.web.wallet.service.IDialogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@Api(tags = "收益提醒")
@RestController
@RequestMapping("/dialog")
public class DialogController extends BaseController {
    @Resource
    private IDialogService dialogService;

    @ApiOperation("获取弹窗状态")
    @PostMapping("/get")
    public AjaxResult getDialog(@RequestBody Dialog dialog) {
        String userId = dialog.getUserId();
        return dialogService.getDialog(userId);
    }

    @ApiOperation("更新弹窗状态")
    @PostMapping("/update")
    public AjaxResult updateDialogStatus(@RequestBody Dialog dialog) {
        String userId = dialog.getUserId();
        return dialogService.updateDialogStatus(userId)?success():error();
    }
}
